package com.bdqn.xiangchuan.web.controller;




import com.bdqn.xiangchuan.base.Khmc;
import com.bdqn.xiangchuan.service.KhmcService;
import com.bdqn.xiangchuan.vo.TreeDataResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;


@RestController
@RequestMapping("khmc")
public class KhmcController {
	@Autowired
	private KhmcService khmcService;

	@RequestMapping("getKhmc")
	@ResponseBody
	public List<TreeDataResult> getAll(){
		List<Khmc> list = khmcService.getAll();
		List<TreeDataResult> treeList = new ArrayList<>();
		treeList.add(new TreeDataResult(0,"所有用户","open",null,-1));
		for(Khmc khmc:list){
			treeList.add(new TreeDataResult(
					khmc.getKhmc_id(),
					khmc.getKhmc_name(),null,null,0));
		}
		return treeList;
	}

}
